package cn.cvs.utils;

import java.sql.Connection;
import java.sql.DriverManager;

/**
 * @Package: cn.cvs.utils
 * @ClassName: BaseDao
 * @Author: 862982795
 * @CreateTime: 2021/07/15 10:25
 * @Description:
 */
public class BaseDao {
    // 获取数据库连接对象
    public static Connection getConnection(){
        Connection connection=null;
        String driver=ConfigManager.getInstance().getValue("jdbc.driver");
        String url=ConfigManager.getInstance().getValue("jdbc.url");
        String username=ConfigManager.getInstance().getValue("jdbc.username");
        String password=ConfigManager.getInstance().getValue("jdbc.password");

        try {
            Class.forName(driver);
            connection= DriverManager.getConnection(url,username,password);
        }catch (Exception e){
            e.printStackTrace();
        }
        return connection;
    }
}
